import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout'

// import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

// 3. 配置路由规则

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/shouye',
    children: [
      // 首页
      {
        path: 'shouye',
        name: 'shouye',
        component: () => import('@/views/shouye/index.vue')
      },
      // 房产
      {
        path: 'fangchan',
        name: 'fangchan',
        component: () => import('@/views/fangchan')
      },
      // 地产
      {
        path: 'dichan',
        name: 'dichan',
        component: () => import('@/views/dichan/index.vue')
      },
      // 关于
      {
        path: 'guanyu',
        name: 'guanyu',
        component: () => import('@/views/guanyu')
      },
      // 地产详情页面
      {
        path: 'dichanxiangqing/:id',
        name: 'dichanxiangqing',
        component: () => import('@/views/dichanxiangqing')
      },
      // 地产列表页面
      {
        path: 'dichanliebiao',
        name: 'dichanliebiao',
        component: () => import('@/views/dichanliebiao')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
